package com.xyoto.community.controller;

import com.xyoto.community.dto.DeleteDynamicCommentReplyLoveDTO;
import com.xyoto.community.dto.SaveQuestionCommentReplyLoveDTO;
import com.xyoto.community.service.QuestionCommentReplyLoveService;
import com.xyoto.community.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

//@RestController
@RequestMapping("/topic")
@Api(value = "问答评论回复点赞（前台）", tags = "问答评论回复点赞（前台）")
public class QuestionCommentReplyLoveController {

    @Autowired
    private QuestionCommentReplyLoveService replyLoveService;

    @ApiOperation(value = "新增问答评论回复点赞（前台）", notes = "新增问答评论回复")
    @PostMapping("/saveQuestionCommentReplyLove")
    public Result saveQuestionCommentReplyLove(@RequestBody @Validated SaveQuestionCommentReplyLoveDTO replyLoveDTO){
        return replyLoveService.saveQuestionCommentReplyLove(replyLoveDTO);
    }

    /**
     * 取消问答评论回复点赞
     * @param deleteDynamicCommentReplyLoveDTO 问答评论回复id
     * @return
     */
    @ApiOperation("取消问答评论回复点赞")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "questionCommentReplyId" , value = "问答评论回复id" , required = true)
    })
    @DeleteMapping("removeQuestionReplyLove")
    public Result removeQuestionCommentReplyLove(@RequestBody DeleteDynamicCommentReplyLoveDTO deleteDynamicCommentReplyLoveDTO){
        return replyLoveService.removeQuestionCommentReplyLove(deleteDynamicCommentReplyLoveDTO.getDynamicCommentReplyId());
    }

}
